module ElectionHelper
  def display_election_item(item, user, election)
    return display_rating(item, user, election) if election.is_a?(RatingElection)
  end
  
  def display_rating(item, user, election)
    vote = Vote.find_by_item_id_and_person_id_and_election_id(item.id, user.id, election.id)
    selected = 0
    selected = vote.score if vote
    render :partial=>'rating_item', :locals=>{:item_id=>item.id, :selected=>selected}
  end
end
